#! /bin/sh
### BEGIN INIT INFO
# Provides:         rttys
# Required-Start:   $network
# Required-Stop:    $network
# Default-Start:    2 3 4 5
# Default-Stop:     0 1 6
# Short-Description: Execute the rttys command.
# Description:
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/lsb/init-functions

RTTYSPID=/var/run/rttys.pid

do_start () {
	start-stop-daemon --start --make-pidfile --pidfile $RTTYSPID --background --exec /usr/local/bin/rttys -- -conf /etc/rttys/rttys.conf
}

do_stop () {
	start-stop-daemon --stop --pidfile $RTTYSPID
	sleep 1
	rm -f $RTTYSPID
}

case "$1" in
  start)
	do_start
	;;
  stop)
	do_stop
	;;
  restart|reload|force-reload)
	echo "Error: argument '$1' not supported" >&2
	exit 3
	;;
  status)
	exit 0
	;;
  *)
	echo "Usage: $0 start|stop" >&2
	exit 3
	;;
esac

